package medicalDeptModel

import (
	"gorm.io/gorm"
	"jjqzplucky.site/sz-core/internal/models"
	medicalDeptSubModel "jjqzplucky.site/sz-core/internal/models/medical_dept_sub"
)

type MedicalDept struct {
	models.BaseModel
	// 科室描述
	Description *string `json:"description"`
	// 科室名称
	Name *string `json:"name"`
	// 是否为门诊科室 1，是：1，否：0
	Outpatient *int8 `json:"outpatient"`
	// 是否为推荐科室 推荐: 1，不推荐: 0
	Recommended *int8                                `json:"recommended"`
	Children    []medicalDeptSubModel.MedicalDeptSub `json:"children" gorm:"foreignKey:DeptID"`
}

func (m *MedicalDept) BeforeCreate(db *gorm.DB) (err error) {
	err = m.BaseModel.BeforeCreate(db)
	return
}

type MedicalDeptDto struct {
	Id          uint64  `json:"id"`
	Name        *string `json:"name" binding:"required"`
	Outpatient  *int8   `json:"outpatient" binding:"required"`
	Recommended *int8   `json:"recommended"`
	Description *string `json:"description"`
}

type PageQuery struct {
	Name        *string `form:"name"`
	Outpatient  *int8   `form:"outpatient"`
	Recommended *int8   `form:"recommended"`
	models.PageParam
}

type SimpleMedical struct {
	Id   uint64 `json:"id"`
	Name string `json:"name"`
}
